package com.newcapec.org.demo.controller;

import com.newcapec.org.demo.entity.EmployeeInfo;
import com.newcapec.org.demo.entity.Result;
import com.newcapec.org.demo.service.EmployeeInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/employee")
public class EmployeeInfoController {

    @Resource
    private EmployeeInfoService employeeInfoService;
    @GetMapping("/selectByUserId/{userId}")
    public Result<EmployeeInfo> selectByUserId(@PathVariable("userId") Integer userId){
        Result<EmployeeInfo> result = new Result<>();
        result.setData(employeeInfoService.selectByUserId(userId));
        result.setCode(200);
        return result;
    }
}
